package com.journaldev.thread.chenhao;

/**
 * join示例
 *
 * @author: chenhs
 * @date: Created in 15:49 2019/9/4
 **/
public class TestThreadJoin {

    public static void main(String[] args) {

        SubThreadJoin subThreadJoin = new SubThreadJoin();
        subThreadJoin.start();

        for (int i = 0; i <= 100; i++) {
            System.out.println(Thread.currentThread().getName() +" : " + i);
            if (i == 10) {
                try {
                    subThreadJoin.join();
                } catch (InterruptedException e) {
                    e.printStackTrace();
                }

            }

        }

    }

}
